package com.qinsong.myapplication.model.db;

import android.content.Context;

import com.qinsong.myapplication.model.dao.ContactDao;
import com.qinsong.myapplication.model.dao.InvitationDao;

/**
 * 联系人邀请信息操作管理
 */
public class DBManager {
    private final DBHelper dbHelper;
    private final ContactDao contactDao;
    private final InvitationDao invitationDao;
    public DBManager(Context context,String name) {
        //创数据库
        dbHelper = new DBHelper(context,name);
        //创建联系人与邀请信息的表的操作类
        contactDao=new ContactDao(dbHelper);
        invitationDao=new InvitationDao(dbHelper);
    }

    /**
     * 获取联系人表的操作对象
     * @return
     */
    public  ContactDao getContactDao(){
        return contactDao;
    }

    /**
     * 获取邀请信息表的操作对象
     * @return
     */
    public InvitationDao getInvitationDao() {
        return invitationDao;
    }

    /**
     * 关闭数据库的方法
     */
    public void close() {
        dbHelper.close();
    }
}
